<?php echo js('admin/settings.js');?>
<?php echo js('jquery/timepicker/jquery.timePicker.min.js');?>
<?php echo css('admin/timepicker/timePicker.css');?>
<script type="text/javascript">
$(function(){
	$("#checkin_time").timePicker({
		  startTime: "0.00", // Using string. Can take string or Date object.
		  endTime: new Date(0, 0, 0, 23, 45, 0), // Using Date object here.
		  show24Hours: false,
		  separator: '.',
		  step: 15});
	$("#checkout_time").timePicker({
		  startTime: "0.00", // Using string. Can take string or Date object.
		  endTime: new Date(0, 0, 0, 23, 45, 0), // Using Date object here.
		  show24Hours: false,
		  separator: '.',
		  step: 15});
});
</script>  
<?php echo js('jquery/popupWindow/jquery.popupWindow.js');?>
<script type="text/javascript">
	function delte_pickup_image(){
		$('#pickup_image_holder').html("");
		$('#pickup_image').val("");
	}
	jQuery(function($){
		$('#a_pickup').popupWindow({height:500, width:800, centerBrowser:1}); 
	});
</script>  

<div id="page-heading"><h1><?php echo lang('hotels.create_title') ?></h1></div>
<?php $this->load->view('partials/notices'); ?>
<form method="post" action="<?php echo site_url('admin/catalog/create_hotel');?>" >
<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		<tr>
			<th valign="top"><?php echo lang('hotels.available_label'); ?><span class="require">*</span>:</th>
			<td><?php echo form_dropdown('available', array(1 => lang('global:yes'), 0 => lang('global:no')), $hotel->available, 'id="available" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.recommended'); ?><span class="require">*</span>:</th>
			<td><?php echo form_dropdown('recommended', array(1 => lang('global:yes'), 0 => lang('global:no')), $hotel->recommended, 'id="recommended" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.city_id'); ?><span class="require">*</span>:</th>
			<?php 
			$cities_option = array();
			foreach($cities as $city){
				$cities_option[$city->id] = empty($city->name)? lang('global:empty'): $city->name;
			}
			?>
			<td><?php echo form_dropdown('city_id', $cities_option, $hotel->city_id, 'id="city_id" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.rating'); ?><span class="require">*</span>:</th>
			<?php 
			$rating_option = array(
					0 => lang('hotels.rating-0'), 
					1 => lang('hotels.rating-1'), 
					'1.5' => lang('hotels.rating-1.5'), 
					2 => lang('hotels.rating-2'), 
					'2.5' => lang('hotels.rating-2.5'), 
					3 => lang('hotels.rating-3'), 
					'3.5' => lang('hotels.rating-3.5'), 
					4 => lang('hotels.rating-4'), 
					'4.5' => lang('hotels.rating-4.5'), 
					5 => lang('hotels.rating-5'),
					'5.5' => lang('hotels.rating-5.5'), 
					6 => lang('hotels.rating-6')
			);
			?>
			<td><?php echo form_dropdown('rating', $rating_option, $hotel->rating, 'id="rating" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.price'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('price', $hotel->price, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.discountprice'); ?>:</th>
			<td><?php echo form_input('discountprice', $hotel->discountprice, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.credits'); ?>:</th>
			<td><?php echo form_input('credits', $hotel->credits, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.tel'); ?>:</th>
			<td><?php echo form_input('tel', $hotel->tel, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.latitude'); ?>:</th>
			<td><?php echo form_input('latitude', $hotel->latitude, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.longitude'); ?>:</th>
			<td><?php echo form_input('longitude', $hotel->longitude, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.checkin_time'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('checkin_time', $hotel->checkin_time, 'id="checkin_time"  class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.checkout_time'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('checkout_time', $hotel->checkout_time, 'id="checkout_time"  class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('global:sort'); ?>:</th>
			<td><?php echo form_input('sort', $hotel->sort, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.image'); ?>:</th>
			<td>
			<input type="hidden" value="<?php echo $hotel->image?>" name="image" id="pickup_image"/>
			<a href="<?php echo site_url('admin/folders/pickup_image')?>" id="a_pickup"><img src="<?php echo image_url('admin/shared/icon.png')?>"/></a>
			<div id="pickup_image_holder">
			<?php if(!empty($hotel->image)):?>
				<a href="javascript:void(0);" onclick="delte_pickup_image()"><img src="<?php echo site_url('files/thumb/' . $hotel->image . '/64/64?'. rand(0, 99)); ?>" title="click to delete"/></a>
			<?php endif;?>
			</div>
			</td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('hotels.address'); ?>:</th>
			<td><?php echo form_textarea('address', $hotel->address, 'class="form-textarea"'); ?></td>
		</tr>
</table>	
<table border="0" cellpadding="0" cellspacing="0"  id="id-form" style="width:100%;">
		<tr>
			<th colspan="3">
			<div id="usual-tab" class="usual-tab">
				<ul class="idTabs"> 
					<?php foreach($supported_languages as $lang => $content): ?>
						<li><a href="#<?php echo $lang;?>"><span style="font-weight: bold; font-size:12px;"><?php echo $content['name'];?></span></a></li>
					<?php endforeach; ?>
				</ul>
				<?php foreach($supported_languages as $lang => $content): ?>
					<div id="<?php echo $lang;?>" class="lang_content">
						<fieldset>
							<table border="0" cellpadding="0" cellspacing="0"  id="id-form" style="width:100%;">
							<tr>
								<th valign="top"><?php echo lang('hotels.name_label'); ?><span class="require">*</span>:</th>
								<td><?php echo form_input('name_'. $lang, $hotel->{'name_'. $lang}, 'class="inp-form"'); ?></td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('hotels.catering'); ?>:</th>
								<td><?php echo form_input('catering_'. $lang, $hotel->{'catering_'. $lang}, 'class="inp-form"'); ?></td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('hotels.internet'); ?>:</th>
								<td><?php echo form_input('internet_'. $lang, $hotel->{'internet_'. $lang}, 'class="inp-form"'); ?></td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('hotels.introduction_label'); ?>:</th>
								<td><?php echo form_textarea('introduction_'. $lang, $hotel->{'introduction_'. $lang}, 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('introduction_'. $lang)); ?>
								</td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('hotels.description_label'); ?>:</th>
								<td><?php echo form_textarea('description_'. $lang, $hotel->{'description_'. $lang}, 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('description_'. $lang)); ?>
								</td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('hotels.price_specification'); ?>:</th>
								<td><?php echo form_textarea('price_specification_'. $lang, $hotel->{'price_specification_'. $lang}, 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('price_specification_'. $lang)); ?>
								</td>
							</tr>
							</table>
						</fieldset>	
					</div> 
				<?php endforeach; ?> 
			</div> 
			</th>
		</tr>
	<tr>
		<th>&nbsp;</th>
		<td valign="top">
			<input type="submit" value="" class="form-submit" />
			<input type="reset" value="" class="form-reset"  />
		</td>
		<td></td>
	</tr>
	</table>
</form>	
